package com.py.payment.controller;

import com.py.payment.entity.PyIngredients;
import com.py.payment.service.PyIngredientsService;
import com.py.payment.tools.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin(origins = "*")
@RequestMapping("ingredients")
public class IngredientsController {

    @Autowired
    private PyIngredientsService ingredientsService;

    @PostMapping(name = "获取原料列表",path = "/getIngredientsList")
    public ResponseData getIngredientsList() {
        List<PyIngredients> ingredientsList = this.ingredientsService.list();
        return ResponseData.success(ingredientsList);
    }
}
